/**
 * @Project POL3Cay
 * @Author Tran Manh Hung
 * @Email: hungtmit@gmail.com | tmh@xwebgate.com
 * @Copyright © 2011 TMH. All rights reserved
 * @Createdate Feb 18, 2011
 * @Createtime 10:50:56 AM
 */

package models.card
{

	public class Card
	{
		public static const CLUBS:int = 1; // ♣

		public static const DIAMONDS:int = 2; // ♦

		public static const HEARTS:int = 3; // ♥

		public static const SPADES:int = 4; // ♠

		public static const ACE:int = 1;

		public static const JACK:int = 11;

		public static const QUEEN:int = 12;

		public static const KING:int = 13;

		protected var _value:int; // A(ce), 2, 3, 4, 5, 6, 7, 8, 9, 10, J(ack), Q(ueen), K(ing)

		protected var _rank:int; // rank != value

		protected var _suit:int; // spades (♠), hearts (♥), diamonds (♦), clubs (♣)

		protected var _suitRank:int;

		protected var _weight:Number; // order in deck | from light to heavy...

		public function Card(value:int = 0, suit:int = 0)
		{
			_value = value;
			_rank = 0; // same rank
			_suit = suit;
			_suitRank = 0; // same rank
			_weight = 0;
		}

		public function toString(prefix:String = ""):String
		{
			var ret:String = prefix + "[";

			switch (_value)
			{
				case Card.ACE:
					ret += "A";
					break;
				case 2:
				case 3:
				case 4:
				case 5:
				case 6:
				case 7:
				case 8:
				case 9:
				case 10:
					ret += _value.toString();
					break;
				case Card.JACK:
					ret += "J";
					break;
				case Card.QUEEN:
					ret += "Q";
					break;
				case Card.KING:
					ret += "K";
					break;
				default:
					ret += "-";
					break;
			}

			switch (_suit)
			{
				case Card.CLUBS:
					ret += "♣]";
					break;
				case Card.DIAMONDS:
					ret += "♦]";
					break;
				case Card.HEARTS:
					ret += "♥]";
					break;
				case Card.SPADES:
					ret += "♠]";
					break;
				default:
					ret += "-]";
					break;
			}

			return ret;
		}

		public function get suit():int
		{
			return _suit;
		}

		public function set suit(value:int):void
		{
			_suit = value;
		}

		public function get value():int
		{
			return _value;
		}

		public function set value(value:int):void
		{
			_value = value;
		}

		public function get weight():Number
		{
			return _weight;
		}

		public function set weight(value:Number):void
		{
			_weight = value;
		}

		public function get rank():int
		{
			return _rank;
		}

		public function set rank(value:int):void
		{
			_rank = value;
		}

		public function get suitRank():int
		{
			return _suitRank;
		}

		public function set suitRank(value:int):void
		{
			_suitRank = value;
		}


	}
}